package com.itheima.hmshopping.util;

import cn.hutool.core.convert.Convert;
import io.jsonwebtoken.Claims;

public class Token {


    public static Long getTonken(String token){
        //判断token
        Claims claimsBody = JwtUtil.getClaimsBody(token);
        int i = JwtUtil.verifyToken(claimsBody);
        if (i == 1 || i == 2) {
            throw new ClassCastException("token已过期");
        }

        return Convert.toLong( claimsBody.get("id"));
    }

}
